<template>
    <table border="1">
        <tr>
            <td>公告类型</td>
            <td>
                <input type="text" v-model="info.ntname">
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                <input type="button" value="保存" @click="add">
            </td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import axios from 'axios';
const info=ref({
    "ntid": 0,
    "ntname": ""
})
const add=()=>{
    if(info.value.ntname==""){
        alert('类型名称不能为空');
        return;
    }
    axios.post('http://localhost:63668/api/Notice/AddNoType',info.value)
    .then(res=>{
        if(res.data>0){
            alert('保存成功');
        }
        else{
            alert('保存失败');
        }
    })
    .catch(error=>{
        console.log(error);
    })
}
</script>